<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*-----------------------------------------------------------------------------------------------
get_login_block()
-----------------------------------------------------------------------------------------------*/
class Login_block extends Front_Controller{
    var $init;
    function Login_block(){
        parent::Front_Controller();
    }

    function index(){
        $CI = &get_instance();
		$CI->load->module_model('blocks.login_model');
		$CI->load->module_library('blocks.FrontAuth');
		$action = $CI->uri->segment(2);
		$type_id = $CI->uri->segment(3);
		if($action=='logout'){
			$this->logout();
		}
		else{
			$logged  = 0;
	        if($CI->frontauth->is_logged()){
				$data = $CI->frontauth->get_auth_data();
				$logged = 1;
				$this->add('login_email',$data['login_email']);
			}			
			$this->add('logged',$logged);
			$this->view(get_class($this));
		}
    }
	
	function logout(){
		$CI = &get_instance();
		$CI->load->module_library('blocks.FrontAuth');
        $CI->frontauth->logout();
	}	


}